<?php echo $this -> Html -> script('jquery.validate.js'); ?>
<script type="text/javascript">
</script>
<style>
label.error
{
    color: red;
}
</style>

<?php
	echo $this -> Form -> create('form1', array('data-ajax' => 'false', 'id' => 'form1', 'enctype' => 'multipart/form-data'));
	echo $this -> Html -> script(array('customer.js'));
	echo $this -> Html -> css(array('pc.css', 'customer.css'));
	echo $this -> Form -> input('hdCustomer', array('type' => 'hidden', 'id' => 'hdCustomer', 'name' => 'hdCustomer'));
	echo $this -> Form -> input('hdCustomerPid', array('type' => 'hidden', 'id' => 'hdCustomerPid', 'name' => 'hdCustomerPid'));
	echo $this -> Form -> input('hdUploadFile', array('type' => 'hidden', 'id' => 'hdUploadFile', 'name' => 'hdUploadFile'));
?>
<div class="pc_index_customer">
    <div style="width: 800px; margin-left:20px;">
        <table>
            <tr>
                <th class="pc_index_text_left">　患者様　氏名</th>
                <td><input class="pc_index_text_right" type="text" name="txtCustomerName" id="txtCustomerName" value="<?php echo $txtCustomerName;?>"></td>
            </tr>
            <tr>
                <th class="pc_index_text_left">　診察券番号</th>
                <td><input class="pc_index_text_right" type="text" name="txtCustomerNo" id="txtCustomerNo" value="<?php echo $txtCustomerNo; ?>"></td>
            </tr>
            <tr>
                <th class="pc_index_text_left">　電話番号</th>
                <td><input class="pc_index_text_right" type="text" name="txtMobile" id="txtMobile" value="<?php echo $txtMobile; ?>"></td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" name="searchName" id="searchName" value="検索" style="width: 60px; height: 30px;" />
                    <input type="button" name="clearText" id="clearText" value="クリア" style="width: 60px; height: 30px;" />
                </td>
            </tr>
        </table>
            <input type="hidden" name="mode" id="mode">
            <input type="hidden" name="sortFiel" id="sortFiel">
            <input type="hidden" name="idUpdate" id="idUpdate">
    </div>
    <div class="pc_container">
        <div style="height: 50px;">
            <div style="float:right; margin-right: 20px; margin-top: 24px;">
                <input class="customer_import_csv" type="button" name="importCSV" id="importCSV" value="" />
            </div>

            <br>
            <input type="button" name="addNew" id="addNew" value="新規作成" style="height: 30px;vertical-align: 10px;">
            <?php
                echo $this -> Paginator -> first('', array('id' =>'pageFirst'));
                if ($this -> Paginator -> first('<< 最初') == null) {
                    echo "<span class='currentFirst'></span>";
                }
                //echo $this->Paginator->prev('< Previous ', null, null, array('class' => 'disabled')); //Shows the next and previous links
                echo " " . $this -> Paginator -> numbers(array('id' => 'numberId')) . " "; //Shows the page numbers
                if ($this -> Paginator -> numbers() == null) {
                    echo "<span class='current'>1</span>";
                }
                //echo $this->Paginator->next('Next　>', null, null, array('class' => 'disabled')).'　'; //Shows the next and previous links
                echo $this -> Paginator -> last('', array('id' => 'pageLast'));
                if ($this -> Paginator -> last('最後  >>') == null) {
                    echo "<span class='currentLast'></span>";
                }
                //echo " Page ".$this->Paginator->counter(); // prints X of Y, where X is current page and Y is number of pages
            ?>
        </div>
        <div style="clear: both;"></div>
        <div style="height:820px; ">
            <div class="pc_customer_table">
                <table bgcolor="#FFF" id="tableId" border="0px" cellspacing="0" width="844px" style="border-collapse: collapse;">
                    <tbody >
                        <tr>
                            <th class="pc_customer_class_color_FFF" align="left" width="20%" height="24px"><?php echo $this -> Paginator -> sort('id', 'No.');?></th>
                            <th class="pc_customer_class_color_FFF" align="left" width="35%"><?php echo $this -> Paginator -> sort('customerName', '氏名');?></th>
                            <th class="pc_customer_class_color_FFF" align="left" width="20%"><?php echo $this -> Paginator -> sort('customerNo', '診察券番号');?></th>
                            <th class="pc_customer_class_color_FFF" align="left" width="25%"><?php echo $this -> Paginator -> sort('mobile', '電話番号');?></th>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="pc_customer_table">
                <table bgcolor="#FFF" border="0px" cellspacing="0" width="844px" style="border-collapse: collapse;">
                    <tbody>
                            <?php
                                $color = 1;
                                   foreach ($view as $itemView) {
                                       if ($color % 2 == 0) {
                                           echo "<tr class='container-area'>";
                                        echo "<td class='pc_customer_class_color' width='20%' height='24px'><a href='#' onclick='updateCustomer(" . $itemView['Customer']['id'] . ")'>No.　" . $itemView['Customer']['id'] . "</a></td>";
                                        echo "<td class='pc_customer_class_color' width='35%' height='24px'><div style='overflow: auto; width:250px;'>" . $itemView['Customer']['customerName'] . "</div></td>";
                                        echo "<td class='pc_customer_class_color' width='20%' height='24px'>" . $itemView['Customer']['customerNo'] ."</td>";
                                        echo "<td class='pc_customer_class_color' width='25%' height='24px'><div style='overflow: auto; width:auto;'>" . $itemView['Customer']['mobile'] . "</div></td>";
                                        echo "</tr>";
                                       } else {
                                           echo "<tr class='container-area'>";
                                        echo "<td class='pc_customer_class_color_FFF' width='20%' height='24px'><a href='#' onclick='updateCustomer(" . $itemView['Customer']['id'].")'>No.　" . $itemView['Customer']['id'] . "</a></td>";
                                        echo "<td class='pc_customer_class_color_FFF' width='35%' height='24px'><div style='overflow: auto; width:250px;'>" . $itemView['Customer']['customerName'] . "</div></td>";
                                        echo "<td class='pc_customer_class_color_FFF' width='20%' height='24px'>" . $itemView['Customer']['customerNo'] . "</td>";
                                        echo "<td class='pc_customer_class_color_FFF' width='25%' height='24px'><div style='overflow: auto;'>" . $itemView['Customer']['mobile'] ."</div></td>";
                                        echo "</tr>";
                                       }
                                    $color++;
                               }
                            ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<div id="yoyaku_bg" class="reveal-modal">
    <div id="yoyaku_bg_child" class="customer_add_bg">
        <div style="padding:20px 0px 0px 200px;font-size: 30px;">
            <span style="text-align: center;">患者情報編集</span>
        </div>
        <table width="450" border="0" cellspacing="2" cellpadding="10" style="margin-left:10px;" id="popupTable">
            <tr>
                <td align="center" colspan="2">
                </td>
            </tr>
            <tr>
                <td align="left" bgcolor="#EDEEEF">患者様　氏名</td>
                <td align="left" bgcolor="#FFFFFF"><input class="customer_width_textbox_lv1" maxlength="50" type="text" id="txtAddCustomerName" name="txtAddCustomerName" /></td>
            </tr>
            <tr>
                <td width="165" align="left" bgcolor="#EDEEEF">診察券番号</td>
                <td width="239" align="left" bgcolor="#FFFFFF"><input class="customer_width_textbox_lv1" style="ime-mode:disabled;" maxlength="15" type="text" id="txtAddCustomerNo" name="txtAddCustomerNo" /></td>
            </tr>
            <tr>
                <td align="left" bgcolor="#EDEEEF">電話番号</td>
                <td align="left" bgcolor="#FFFFFF">
                	<input class="customer_width_textbox_lv1" style="ime-mode:disabled;" maxlength="15" type="text" id="txtAddMobile" name="txtAddMobile" />
                	<br>
                	<label style="color: red;" id="messageUpdateMobile"></label>
                </td>
            </tr>
            <tr>
                <td align="left" bgcolor="#EDEEEF">前回来院日</td>
                <td align="left" bgcolor="#FFFFFF"><input readonly="readonly" class="customer_width_textbox_lv1" id="txtViewDate" name="txtViewDate" style="ime-mode:disabled;" type="text" /></td>
            </tr>
        </table>
        <table width="450" border="0" cellspacing="2" cellpadding="10" style="margin-left:10px; display: none;" id="popupConfirmTable">
            <tr>
                <td align="center" colspan="2">
                </td>
            </tr>
            <tr>
                <td align="left" bgcolor="#EDEEEF">患者様　氏名</td>
                <td align="left" bgcolor="#FFFFFF"><label id="popupConfirmName"></label></td>
            </tr>
            <tr>
                <td width="165" align="left" bgcolor="#EDEEEF">診察券番号</td>
                <td width="239" align="left" bgcolor="#FFFFFF"><label id="popupConfirmNo"></label></td>
            </tr>
            <tr>
                <td align="left" bgcolor="#EDEEEF">電話番号</td>
                <td align="left" bgcolor="#FFFFFF"><label id="popupConfirmMobile"></label></td>
            </tr>
            <tr>
                <td align="left" bgcolor="#EDEEEF">前回来院日</td>
                <td align="left" bgcolor="#FFFFFF"><label id="popupConfirmViewDate"></label></td>
            </tr>
        </table>
        <table width="450" border="0" align="center" cellpadding="5" cellspacing="0" id="btnTable">
            <tr>
                <td align="right" id="confirmCustomer">
                    <input type="button" value="確認" class="btnCustomer" onclick="updateConfirm()">
                    <input type="button" value="閉じる" class="btnClose close-reveal-modal" >
                </td>
                <td align="right" id="btnConfirm" style="display: none;">
                    <input type="button" value="更新" class="btnCustomer" onclick="saveCustomer()">
                    <input type="button" value="戻る" class="btnClose" onclick="backUpdateConfirm()">
                    <!--<input type="button" value="閉じる" class="btnClose close-reveal-modal" >-->
                </td>
            </tr>
        </table>
    </div>
</div>
<div id="popupInsertCustomer" class="reveal-modal">
    <div id="yoyaku_bg_child" class="customer_add_bg">
            <div style="padding:20px 0px 0px 200px;font-size: 30px;">
                <span style="text-align: center;">患者情報編集</span>
            </div>
            <table width="450" border="0" cellspacing="2" cellpadding="10" style="margin-left:10px;" id="popupInsertTable">
                <tr>
                    <td align="center" colspan="2">
                    </td>
                </tr>
                <tr>
                    <td align="left" bgcolor="#EDEEEF">患者様　氏名</td>
                    <td align="left" bgcolor="#FFFFFF"><input class="customer_width_textbox_lv1" maxlength="50" type="text" id="txtInsertCustomerName" name="txtInsertCustomerName" /></td>
                </tr>
                <tr>
                    <td width="165" align="left" bgcolor="#EDEEEF">診察券番号</td>
                    <td width="239" align="left" bgcolor="#FFFFFF"><input class="customer_width_textbox_lv1" style="ime-mode:disabled;" maxlength="15" type="text" id="txtInsertCustomerNo" name="txtInsertCustomerNo" /></td>
                </tr>
                <tr>
                    <td align="left" bgcolor="#EDEEEF">電話番号</td>
                    <td align="left" bgcolor="#FFFFFF">
                    	<input class="customer_width_textbox_lv1" style="ime-mode:disabled;" maxlength="15" type="text" id="txtInsertMobile" name="txtInsertMobile" />
                    	<br>
                    	<label style="color: red;" id="messageMobile"></label>
                    </td>
                </tr>
            </table>
            <table id="confirmInsertTable" style="display: none;" width="450" border="0" cellspacing="2" cellpadding="10" style="margin-left:10px;">
                <tr>
                    <td>患者様　氏名</td>
                    <td><label id="confirmInsertCustomerName"></label></td>
                </tr>
                <tr>
                    <td>診察券番号</td>
                    <td><label id="cofirmInsertCustomerNo"></label></td>
                </tr>
                <tr>
                    <td>電話番号</td>
                    <td><label id="cofirmInsertMobile"></label></td>
                </tr>
            </table>
            <table width="450" border="0" align="center" cellpadding="5" cellspacing="0" id="btnTable">
            <tr>
                <td align="right" id="saveInsertCustomer">
                    <input type="button" value="確認" class="btnCustomer" onclick="confirmInsertCustomer()">
                    <input type="button" value="閉じる" class="btnClose close-reveal-modal" >
                </td>
                <td align="right" id="saveInsertCustomerConfirm" style="display: none;">
                    <input type="button" value="更新" class="btnCustomer" onclick="saveInsertCustomer()">
                    <input type="button" value="戻る" class="btnClose" onclick="backInsertConfirm()" >
                    <!--<input type="button" value="閉じる" class="btnClose close-reveal-modal" >
                --></td>
            </tr>
        </table>
    </div>
</div>
<div id="upload_file" class="reveal-modal">
    <div id="upload_file_child" class="upload_file_add_bg">
        <input size="40" type="file" name="FileImage" id="FileImage" />
        <div>
            <span style="margin-right: 30px;">
                <input type="button"  onclick="submitForm()" class="btnCustomerImg" id="btnUpdateCustomer" name="btnUpdateCustomer">
            </span>
            <span style="margin-left: 20px;">
                <input type="button"  class="close-reveal-modal btnUpdateCustomerImg" >
            </span>
        </div>
    </div>
</div>
<?php
    if (isset($updateCustomer)) {
        echo "<script>alert('正常に保存しました。');</script>";
    }
    echo $this -> Form -> end();
?>